package dreampack.dataType;

import java.sql.*;
import java.util.*;
import dreampack.*;

public class MonStarType {
	private int userId;
	private String userName;
	private int monStarType;
	private String monStarTitle;
	private Timestamp durTime;
	private int totalScore;
	private String choosedReason;
	private String briefIntroduce;
	
	public MonStarType() { };

	public boolean init(DreamDB dreamDb, ResultSet rs) throws Exception {
		boolean bRet = true;
		try {
			this.userId = (int)rs.getInt("id");
			this.userName = (String)rs.getString("name");
			this.monStarType = (int)rs.getInt("type_id");
			this.monStarTitle = (String)rs.getString("type_name");
			this.durTime = (Timestamp)rs.getTimestamp("dur_time");
			this.totalScore = (int)rs.getInt("score");
			this.choosedReason = (String)rs.getString("reason");
			this.briefIntroduce = (String)rs.getString("brief_intro");
		} catch (Exception e) {
			bRet = false;
		}
		return bRet;
	}
	public int getUserId() {
		return this.userId;
	}
	
	public String getUserName() {
		return this.userName;
	}
	
	public int getStarType() {
		return this.monStarType;
	}
	
	public String getStarTitle() {
		return this.monStarTitle;
	}
	
	public java.util.Date getDurTime() {
		java.util.Date tempDate = null;
		if (null != this.durTime) {
			Calendar cal = Calendar.getInstance();
			cal.setTimeInMillis(this.durTime.getTime());
			tempDate = cal.getTime();
		}
		return tempDate;
	}
	
	public int getTotalScore() {
		return this.totalScore;
	}
	
	public String getChoosedReason() {
		return this.choosedReason;
	}
	
	public String getBriefIntroduce() {
		return this.briefIntroduce;
	}
}
